PSPSDK=$(shell psp-config --pspsdk-path)
PSPDEV=$(shell psp-config --psp-prefix)
PSPBIN=$(PSPDEV)/bin
INSTALL_DIR = $(PSPDEV)/include/objectdraw
INSTALL_LIB_DIR = $(PSPDEV)/lib

TARGET_LIB = libobjdraw++.a

OBJS = 	src/Object.o \
		src/GraphicsInstance.o \
		src/VirtualFile.o \
		src/vfile/vfileOpsFILE.o \
		src/Color.o \
		src/Location.o \
		src/KeyListener.o \
		src/CanvasManager.o \
		src/DrawingCanvas.o \
		src/DrawableInterface.o \
		src/Drawable1DInterface.o \
		src/Drawable2DInterface.o \
		src/Resizable2DInterface.o \
		src/Line.o \
		src/FilledRect.o \
		src/FramedRect.o \
		src/Font.o \
		src/Text.o \
		src/Image.o \
		src/Sprite.o \
		src/AnimSprite.o \
		src/imageutil/ImageUtil.o \
		src/imageutil/ImageUtil_convertImageTo.o \
		src/imageutil/ImageUtil_png.o 

INCDIR =  
CFLAGS = -O2 -G0 -Wall -g 
CXXFLAGS = $(CFLAGS) -fexceptions -frtti
ASFLAGS = $(CFLAGS)

INCS = -I./header \
	   -I/usr/local/pspdev/include \
	   -I/usr/local/pspdev/psp/include \
	   -I/usr/local/pspdev/psp/include/c++/4.3.3 \
	   -I/usr/local/pspdev/psp/sdk/include 

CFLAGS := $(INCS)

LIBDIR =
LDFLAGS =

LIBS = -lintraFont -lpspgum -lpspgu -lpspvalloc -lpsprtc -lstdc++ -lm

include $(PSPSDK)/lib/build.mak

install: 
	@mkdir -p $(INSTALL_DIR)
	cp -f header/CanvasManager.h $(INSTALL_DIR)
	cp -f header/Color.h $(INSTALL_DIR)
	cp -f header/Drawable1DInterface.h $(INSTALL_DIR)
	cp -f header/Drawable2DInterface.h $(INSTALL_DIR)
	cp -f header/DrawableInterface.h $(INSTALL_DIR)
	cp -f header/DrawingCanvas.h $(INSTALL_DIR)
	cp -f header/FilledRect.h $(INSTALL_DIR)
	cp -f header/Font.h $(INSTALL_DIR)
	cp -f header/FramedRect.h $(INSTALL_DIR)
	cp -f header/GraphicsInstance.h $(INSTALL_DIR)
	cp -f header/Image.h $(INSTALL_DIR)
	cp -f header/ImageUtil.h $(INSTALL_DIR)
	cp -f header/KeyListener.h $(INSTALL_DIR)
	cp -f header/Line.h $(INSTALL_DIR)
	cp -f header/Location.h $(INSTALL_DIR)
	cp -f header/objdraw.h $(INSTALL_DIR)
	cp -f header/Object.h $(INSTALL_DIR)
	cp -f header/Resizable2DInterface.h $(INSTALL_DIR)
	cp -f header/Sprite.h $(INSTALL_DIR)
	cp -f header/AnimSprite.h $(INSTALL_DIR)
	cp -f header/Text.h $(INSTALL_DIR)
	cp -f header/Types.h $(INSTALL_DIR)
	cp -f header/VirtualFile.h $(INSTALL_DIR)
	@mkdir -p $(INSTALL_DIR)/vfileops
	cp -f header/vfileops/vfileOpsFILE.h $(INSTALL_DIR)/vfileops
	cp -f header/vfileops/vfileOpsMEM.h $(INSTALL_DIR)/vfileops
	cp -f header/vfileops/vfileOpsSDL_RW.h $(INSTALL_DIR)/vfileops
	@cd ..
	@mkdir -p $(INSTALL_LIB_DIR)
	cp -f $(TARGET_LIB) $(INSTALL_LIB_DIR)
	@echo
	@echo "** Headerfiles installed in $(INSTALL_DIR)"
	@echo "** Library files installed in $(INSTALL_LIB_DIR)"